package com.yanqu.road.entity.activity.jiuzhou.config;

import com.yanqu.road.entity.FieldTypeAnnotation;

import java.util.ArrayList;
import java.util.List;

@FieldTypeAnnotation(tableName = "t_s_activity_ninechess_round")
public class JiuZhouRoundConfig {

    @FieldTypeAnnotation(desc = "活动ID", select = true)
    private int activityId;

    @FieldTypeAnnotation(desc = "轮次id")
    private int id;

    @FieldTypeAnnotation(desc = "轮次类型 1 积分赛 2 淘汰赛")
    private int type;

    @FieldTypeAnnotation(desc = "晋级排名条件")
    private List<Integer> upRank;

    @FieldTypeAnnotation(desc = "战斗积分")
    private String score;

    @FieldTypeAnnotation(desc = "轮次时间")
    private String time;

    //匹配开始时间|备战期开始时间|备战期结束时间|战斗结束时间
    private List<Integer> timeList;

    @FieldTypeAnnotation(desc = "分配规则")
    private String matchRule;

    @FieldTypeAnnotation(desc = "物品奖励")
    private String reward;

    @FieldTypeAnnotation(desc = "战斗参数")
    private String fightParam;

    @FieldTypeAnnotation(desc = "竞猜参数")
    private String guessParam;

    /**
     * 初始血量
     */
    private int initHp;

    /**
     * 攻击造成伤害的参数
      */
    private List<List<Integer>> attackDamageParamList = new ArrayList<>();
    public int getActivityId() {
        return activityId;
    }

    public void setActivityId(int activityId) {
        this.activityId = activityId;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public List<Integer> getUpRank() {
        return upRank;
    }

    public void setUpRank(List<Integer> upRank) {
        this.upRank = upRank;
    }

    public String getScore() {
        return score;
    }

    public void setScore(String score) {
        this.score = score;
    }

    public String getTime() {
        return time;
    }

    public void setTime(String time) {
        this.time = time;
    }

    public String getMatchRule() {
        return matchRule;
    }

    public void setMatchRule(String matchRule) {
        this.matchRule = matchRule;
    }

    public String getReward() {
        return reward;
    }

    public void setReward(String reward) {
        this.reward = reward;
    }

    public String getFightParam() {
        return fightParam;
    }

    public void setFightParam(String fightParam) {
        this.fightParam = fightParam;
    }

    public String getGuessParam() {
        return guessParam;
    }

    public void setGuessParam(String guessParam) {
        this.guessParam = guessParam;
    }
    //匹配开始时间|备战期开始时间|备战期结束时间|战斗结束时间
    public List<Integer> getTimeList() {
        return timeList;
    }

    public void setTimeList(List<Integer> timeList) {
        this.timeList = timeList;
    }

    public int getInitHp() {
        return initHp;
    }

    public void setInitHp(int initHp) {
        this.initHp = initHp;
    }

    public List<List<Integer>> getAttackDamageParamList() {
        return attackDamageParamList;
    }

    public void setAttackDamageParamList(List<List<Integer>> attackDamageParamList) {
        this.attackDamageParamList = attackDamageParamList;
    }

    /**
     * 根据赛区获取晋级人数
     */
    public int getUpRankNum(int zoneType) {
        if (upRank.isEmpty()) {
            return 0;
        }
        return upRank.get(Math.max(0, Math.min(upRank.size() - 1, zoneType - 1)));
    }
}
